%% term_Uold_grad_U_V
function matrix_A = term_Uold_grad_U_V(mesh, fespace, Uold)
Nb1 = fespace.Nb;
Nlb1 = fespace.Nlb;
rows = zeros(mesh.Ne*Nlb1*Nlb1,1);
cols = rows;
val = rows;
flag = 1;
for n = 1:mesh.Ne
    V = mesh.node(mesh.elem(n,:),:);
    [int_points_loc, int_weights_loc] = integral_loc(V, "2d");
    phi = basis_loc(V, int_points_loc(:,1), int_points_loc(:,2), fespace.basis_type, "x");
    phix = basis_loc(V, int_points_loc(:,1), int_points_loc(:,2), fespace.basis_type, "dx");
    phiy = basis_loc(V, int_points_loc(:,1), int_points_loc(:,2), fespace.basis_type, "dy");
    u1 = phi * Uold(fespace.elem(n,:));
    u2 = phi * Uold(fespace.elem(n,:)+Nb1);
    for i = 1:Nlb1
        for j = 1:Nlb1
            f1 = u1 .* phix(:,j) .* phi(:,i) + u2 .* phiy(:,j) .* phi(:,i);
            r1 = int_weights_loc * f1;
            rows(flag) = fespace.elem(n,i);
            cols(flag) = fespace.elem(n,j);
            val(flag) = r1;
            flag = flag + 1;
        end
    end
end
A1 = sparse(rows, cols, val, Nb1, Nb1);
matrix_A = blkdiag(A1,A1);
end